class Solution
{
public:
    long long getDescentPeriods(vector<int> &prices)
    {
        long long result = 0;
        long long continuousDecline = 1;
        int n = prices.size();
        for (int day = 1; day < n; ++day)
        {
            if (prices[day] == prices[day - 1] - 1)
            {
                ++continuousDecline;
            }
            else
            {
                result += continuousDecline * (continuousDecline + 1LL) / 2LL;
                continuousDecline = 1;
            }
        }
        result += continuousDecline * (continuousDecline + 1LL) / 2LL;
        return result;
    }
};